package com.cskaoyan;

import com.cskaoyan.utils.DruidUtils;
import com.cskaoyan.utils.JDBCUtils;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class Main {

    public static void main(String[] args) throws SQLException {

        // 获取连接
        Connection connection = DruidUtils.getConnection();

        Statement statement = connection.createStatement();

        ResultSet resultSet = statement.executeQuery("select * from account");

        while (resultSet.next()) {

            int id = resultSet.getInt("id");
            String name = resultSet.getString("name");
            int money = resultSet.getInt("money");

            System.out.println("id:" + id + ",name :" + name + ",money:" + money);

        }
        // 关闭资源
//        JDBCUtils.closeSource(connection,statement,resultSet);


    }
}
